<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('welcome');
});

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/

// 后台 需要登录
Route::group(['middleware' => ['web','admin.login'],'prefix'=>'admin','namespace'=>'Admin'], function () {
    Route::get('/','IndexController@index');
    Route::get('info','IndexController@info');
    Route::get('quit','LoginController@quit');
    Route::any('pass','IndexController@pass');
    Route::resource('cate','CateController');
    Route::post('cate/changeorder','CateController@changeOrder');
    Route::post('cate/categoryCheck','CateController@categoryCheck');
    Route::resource('article','ArticleController');
    Route::post('article/upload','ArticleController@upload');
    Route::post('article/changeorder','ArticleController@changeOrder');

    // 友情链接
    Route::resource('links','LinksController');
    Route::post('links/changeorder','LinksController@changeOrder');
    // 自定义导航
    Route::resource('nav','NavController');
    Route::post('nav/changeorder','NavController@changeOrder');
    // 网站配置
    Route::resource('config','ConfigController');
    Route::post('config/changeorder','ConfigController@changeOrder');
    Route::post('config/contentupdate','ConfigController@contentUpdate');
    Route::post('config/checkvar','ConfigController@checkVar');
    Route::get('conf/putfile','ConfigController@putFile');
    Route::get('conf/test','ConfigController@test');
    Route::get('element',function (){ return view('admin.element');});


});

// 后台 不需要登录的
Route::group(['middleware' => ['web'],'prefix'=>'admin','namespace'=>'Admin'], function () {
    Route::any('login','LoginController@login');
    Route::get('code','LoginController@code');

});

// 前台
Route::group(['middleware'=>['web'],'namespace'=>'Home'],function (){
    Route::get('/','IndexController@index');
    Route::get('art/{art_id}','IndexController@show');
    Route::get('cate/{cate_id}','IndexController@cate');
    Route::get('test','CommonController@index');

});

Route::any('blog/test',function(){

    echo encrypt('rootroot');
});
